package com.lastcrdg.pieview;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private SinglePictureView mPieview;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mPieview = (SinglePictureView) findViewById(R.id.pv);
        Button check = (Button) findViewById(R.id.check);
        Button unCheck = (Button) findViewById(R.id.uncheck);
        mPieview.setTimeSum(1);
        check.setOnClickListener(this);
        unCheck.setOnClickListener(this);
//        pieview.setData(initData());
    }

    private List<Bean> initData() {
        List<Bean> list = new ArrayList<>();
        list.add(new Bean(50));
        list.add(new Bean(120));
        list.add(new Bean(350));
        list.add(new Bean(70));
        list.add(new Bean(200));
        list.add(new Bean(10));
        return list;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.check:
                mPieview.startCheck();
                break;
            case R.id.uncheck:
                mPieview.startUnCheck();
                break;
        }
    }
}
